package com.weipai.springboot.module.service.impl;

import com.weipai.springboot.model.Test;
import com.weipai.springboot.module.mapper.TestMapper;
import com.weipai.springboot.module.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/07/26 14:28
 */
@Service
public class TestServiceImpl implements TestService {
    
    private static final Logger log = LoggerFactory.getLogger(TestServiceImpl.class); 
    
    @Autowired
    private TestMapper testMapper;

    @Override
    public Map<String, Object> getNameById(Integer id) {
        Map<String,Object> result = new HashMap<>();
        String name = testMapper.findNameById(id);
        log.info("查询出的姓名为:{}",name);
        result.put("name",name);
        result.put("code",200);
        return  result;
    }

    @Override
    public void saveTest(Test test) {
        testMapper.insertSelective(test);
    }
}
